package user_dao

import (
	"data_monitor/pkg/user/user_model"
	"gorm.io/gorm"
)

func UpdateUser(db *gorm.DB, m *user_model.User, id int64) error {
	var user user_model.User
	db.Where("id = ?", id).First(&user)
	user.Name = m.Name
	user.Password = m.Password
	if err := db.Save(user).Error; err != nil{
		return err
	}
	return nil
}